function Message(a_message, a_date)
{
    this.getText = function()
    {
        return a_message;
    }
    
    this.setText = function(m_text)
    {
        a_message = m_text;
    }

    this.getDate = function()
    {
        return a_date;
    }
    
    this.setDate = function(m_date)
    {
        a_date = m_date;
    }
}

var months = new Array("januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december");

Message.prototype.toString = function()
{
    return this.getText()+ " (" + this.getDate() + ")";
}

// TODO: Implement getHTMLText().
Message.prototype.getHTMLText = function()
{
    return this.getText().replace(/[\n\r]/g, "<br />");
}

Message.prototype.getTimeStamp = function()
{
    return this.getDate().toLocaleTimeString();
}

Message.prototype.getFormatedDateTime = function()
{
    var date = this.getDate();
    
    var dateString = date.getDate() + " " + nummericMonthToSwedishString(date.getMonth()) + " " + date.getFullYear() + " klockan " + date.toLocaleTimeString();
    
    return dateString;
}

function nummericMonthToSwedishString(month)
{
    return months[month];
}


